import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    component: () => import("@/views/MainLayout/indexView.vue"),
    children: [
      // 二级路由
      {
        path: "/",
        component: () => import("@/views/Home/indexView.vue"),
      },
      {
        path: "/Classify",
        component: () => import("@/views/Classify/indexView.vue"),
      },
      {
        path: "/Cart",
        component: () => import("@/views/Cart/indexView.vue"),
      },
      {
        path: "/My",
        component: () => import("@/views/My/indexView.vue"),
      },
    ],
  },
  {
    path: "/Login",
    component: () => import("@/views/Login/indexView.vue"),
  },
  {
    path: "/Detail/:id",
    component: () => import("@/views/Detail/indexView.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
